package lg.minecraft.plugin.pokemonmenu.config.builder;

import com.cobblemon.mod.common.pokeball.PokeBall;
import lg.minecraft.plugin.cobblemoncore.util.BukkitNmsConverter;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.List;

/**
 * @author langle__
 * @version 1.0
 */
public class PokemonBallItemBuilder {

    private final List<String> lore;

    public PokemonBallItemBuilder(List<String> lore) {
        this.lore = lore;
    }

    public ItemStack build(PokeBall pokeBall) {
        ItemStack stack = BukkitNmsConverter.toItemStack(pokeBall.stack(1));
        ItemMeta meta = stack.getItemMeta();
        if (meta != null) {
            meta.setLore(lore);
            meta.addItemFlags(ItemFlag.values());
            stack.setItemMeta(meta);
        }
        return stack;
    }

}
